As the index, only -1 (last) or 1 (first) is available in QuoEdit.
-1 (last) specifies the script on the memory last executed by Execute Script menu command:
last script of application "QuoEdit"1 (first) specifies the script on the memory recently recorded by Record Sequence menu command:
script 1 of application "QuoEdit"Note that here the usage of the negative value is special case.
As the index, only 1 is available in QuoEdit.
script 1 of document 1This means a compiled script object from source text from the document.
In QuoEdit, each file is specified by the index 1.
file 1 of application "QuoEdit" -- The file of application itself file 1 of document 1 of application "QuoEdit" -- The file of the document file 1 of last script of application "QuoEdit" -- The file of the last executed scriptYou can take it as a property named “file 1”.
Except “file 1” described above, only negative numbers (or ‘last’ as -1) are available as the index and they identify reference to the recently opened files or the folders.
tell application "QuoEdit" to open last file tell application "QuoEdit" to get folder -1Also here the usage of the negative value is special case. (QuoEdit just wishes to avoid new class declaration for recent files and folders.)
tell application "QuoEdit" to get folder "Scripts" tell application "QuoEdit" to get file "My Doc Prefs..." of folder "Scripts"Those names are relative path starting from the application’s folder.
file "Scripts:My Doc Prefs..." of application "QuoEdit" tell application "QuoEdit" to get folder ":" -- the application’s parent folderAnd if the relative path was not found, it tries the absolute path in normal way.
To refer to continuous text range by Range reference form, the following pattern is available.
text from word 1 to word 4 of document 1The first and the last boundaries can be different classes or more complex references.
text of words 1 thru 4 of document 1The revised edition (For AppleScript 1.3.7, May 1999 —> download) gives an example that shows value of this reference is the list of words in the specified range, while the first edition (1993) gives two examples (maybe misprint) that show it is the continuous text data*. QuoEdit supports this pattern of Range reference according to the revised edition so that the following two Range references are the same value also in QuoEdit. (The former would be still recommended to avoid confusion.)
words 1 thru 4 of document 1 text of words 1 thru 4 of document 1Also the following pattern is available in QuoEdit to refer to the continuous text range.
text 3 thru 7 of document 1It interprets the index for ‘text’ in this case as the character index. But note that the index for ‘text’ class is acceptable for only this form of Range reference. This feature is just for compatibility with AppleScript.
characters 3 thru 7 of document 1 as textBut this is not recommended because of the process; QuoEdit first returns a list of every character in the range, then AppleScript coerces the list to a string.
* | The detailed feature of Range reference is described in chapter 5 “Objects and References” in either editions. Note that some applications may be incompatible with AppleScript in handling the Range reference. |
Suppose that you are going to change a string in the front document using Range Reference form. For example:
This is a badd word. —> This is a correct word.
In this case, the following script would be a good example of a WRONG way, at least in AppleScript language (or in ‘tell’ statements to QuoEdit).
tell application "QuoEdit" set characters 11 thru 14 of document 1 to "correct" -- result: This is a correctcorrectcorrectcorrect word. end tellNote that the reference part means every character in the specified range. (Try compiling this: every character from character 11 to character 14 of document 1)
set text from character 11 to character 14 of document 1 to "correct" set text 11 thru 14 of document 1 to "correct"The point is, as you know, to use ‘text’ class to specify a string.
* | To examine the behavior, create a script file with the following one statement and execute it from QuoEdit (not from the Script Editor) via Execute Script menu command. |